<?php
declare(strict_types=1);
/**
 * MineAdmin is committed to providing solutions for quickly building web applications
 * Please view the LICENSE file that was distributed with this source code,
 * For the full copyright and license information.
 * Thank you very much for using MineAdmin.
 *
 * @Author X.Mo<root@imoi.cn>
 * @Link   https://gitee.com/xmo/MineAdmin
 */
namespace Plugin\Attractions\Commerce\Request\Commerce_order;

use Hyperf\Validation\Request\FormRequest;

/**
 * 订单验证数据类
 */
class CommerceOrderRequest extends FormRequest
{

    public function authorize(): bool
    {
        return true;
    }


    /**
     * 新增数据验证规则
     * return array
     */
    public function rules(): array
    {
        return [
            //商户名称 验证
            'merchant_id' => 'required',
            //客户姓名 验证
            'customer_name' => 'required',
            //订单来源：1-线上下单，2-现场订单 验证
            'order_source' => 'required',
            //订单总金额 验证
            'total_amount' => 'required',
            //实付金额 验证
            'actual_amount' => 'required',

        ];
    }


    /**
     * 字段映射名称
     * return array
     */
    public function attributes(): array
    {
        return [
            'id' => '订单号',
            'merchant_id' => '商户ID',
            'customer_name' => '客户姓名',
            'order_source' => '订单来源：1-线上下单，2-现场订单',
            'total_amount' => '订单总金额',
            'actual_amount' => '实付金额',
            'order_status' => '订单状态：1-未支付，2-已支付，3-已发货，4-已到货，5-已完成，6-已取消',

        ];
    }

public function messages(): array
{
    return [
            'id.required' => '必填订单号',
            'merchant_id.required' => '必填商户ID',
            'customer_name.required' => '必填客户姓名',
            'order_source.required' => '必填订单来源：1-线上下单，2-现场订单',
            'total_amount.required' => '必填订单总金额',
            'actual_amount.required' => '必填实付金额',
            'order_status.required' => '必填订单状态：1-未支付，2-已支付，3-已发货，4-已到货，5-已完成，6-已取消',

    ];
}
}